﻿using LxCFD;

using System.IO;
using System.Windows.Forms;

namespace TimeSolve
{
    public class WriteFileDialog
    {
        public void WriteFile()
        {
            var saveDialog = new SaveFileDialog
            {
                Filter = "VTU|*.vtu|Text|*.txt|All Files|*.*",
                Title = "保存文件"
            };
            if (saveDialog.ShowDialog() == DialogResult.OK)
            {
                if (string.IsNullOrEmpty(saveDialog.FileName))
                {
                    LxConsole.Error("未设置文件名");
                }
                else
                {
                    VTUWriter writer = new VTUWriter();
                    writer.ExportScalars.Add(ScalarTypes.Temperature);
                    writer.ExportScalars.Add(ScalarTypes.Vel_U);
                    writer.WriteFile(saveDialog.FileName);
                    //using (var sw = new StreamWriter(saveDialog.FileName))
                    //{
                    //    sw.Write("Writing Text ");
                    //    sw.WriteLine("Here we go.");
                    //    sw.WriteLine("-------------------");
                    //    sw.WriteLine("Done");
                    //}
                }
            }
        }
    }

}